package com.pug.zixun.local;

import com.pug.zixun.domain.User;

/**
 * @Description: 本地线程缓存
 * @Author: WengYu
 * @CreateTime: 2022/05/20 15:02
 */
public class UserThreadLocal {
    private static ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    // 添加
    public static void put(User user) {
        userThreadLocal.set(user);
    }

    // 获取
    public static User get() {
        return userThreadLocal.get();
    }

    // 删除
    public static void remove() {
        userThreadLocal.remove();
    }
}
